<template>
  <view>
    <view class='productList'>
        <uv-sticky :offsetTop="0" :customNavHeight="0" bgColor="#fff">
          <view class="heightWrapper">
          <view class="tas">
            <uv-tabs @change="tabListChange" :scrollable="false" :current="tabCurrent" :lineColor="themConfig.theme.color"
                     :list="tabList"></uv-tabs>
          </view>

          <view class="search">
            <view class="order-total-text">
              数量：{{ dataPage.total }}
            </view>

            <view @click="openSchool" class="total-search">
              <view class="school-class">{{ schoolName }}</view>
              <uv-action-sheet
                  ref="actionSheet"
                  :actions="schools"
                  title="学校筛选"
                  @select="selectSchool">
              </uv-action-sheet>
            </view>
          </view>
          </view>
        </uv-sticky>

      <PageBody :properties="pageBody" @scrolltolower="scrolltolower">
        <template v-slot:body>
          <uv-gap height="10" v-if="datas.length > 0" bgColor=""></uv-gap>
          <view v-if="datas.length > 0" v-for="(item,index) in datas">
            <view class="student-wrapper">
              <view class="student-item">
                <view>
                  <view class="item-line">
                    <view>用户ID：{{ item.id }}</view>
                    <view>
                      <!--   学生认证状态:0=待审核，1=审核通过，2=审核不通过-->
                      <text style="color:#f9ae3d" v-if="item.state === 0">
                        待审核
                      </text>
                      <text style="color:#5ac725" v-else-if="item.state === 1">
                        通过
                      </text>

                      <text style="color:#f56c6c" v-else-if="item.state === 2">
                        不通过
                      </text>
                    </view>
                  </view>

                  <view class="item-line">
                    <view>时间：{{item.createTime}}</view>
                  </view>

                  <view class="item-line">
                    <view>姓名：{{ item.realName }}</view>
                    <view>联系电话：{{ item.phone }}</view>
                  </view>

                  <view class="item-line">
                    <view>认证学校：{{ item.schoolInfo !== null ? item.schoolInfo.schoolName : '无' }}</view>
                  </view>

                  <view class="item-line">
                    <view>
                      申请说明：
                      {{ item.content }}
                    </view>
                  </view>

                  <view class="item-line">
                    <view>
                      审核备注：
                      <text v-if="item.state===2" style="color: red">{{ item.refuseReason }}</text>
                      <text v-else style="color: #5ac725">{{ item.refuseReason }}</text>
                    </view>
                  </view>

                  <view class="item-line" @click="imgOpenLager(item.studentIdPhotoFront)">
                    <uv-image :height="150" radius="10" width="100%" :src="item.studentIdPhotoFront"></uv-image>
                  </view>
                </view>
                <view class="submit-btn" v-if="item.state===0">
                  <uv-button icon="close" text="拒绝" @click="submit(false,item)"
                             type="default"></uv-button>

                  <uv-button :customTextStyle="{color:themConfig.theme.color}" :iconColor="themConfig.theme.color"
                             icon="checkbox-mark" text="通过" @click="submit(true,item)" type="default"></uv-button>
                </view>
              </view>
            </view>
          </view>

          <Empty :show="datas.length<=0"/>

          <uv-load-more v-if="isReachBottom" @loadmore="loadmore" :status="loading.status" :loading-text="loading.loadingText"
                        :loadmore-text="loading.loadmoreText"
                        nomore-text=" "/>
          <uv-gap height="1" v-if="datas.length > 0" bgColor=""></uv-gap>

        </template>
      </PageBody>
    </view>

    <uv-popup @close="closeForm" closeable :closeOnClickOverlay="false" custom-style="width:300px;border-radius:10px" ref="popup">
      <view style="padding: 30rpx">
       <view style="padding-bottom: 15rpx">
         审核状态：
         <text style="color:#5ac725" v-if="form.state === 1">
           通过
         </text>
         <text style="color:#f56c6c" v-else-if="form.state === 2">
           拒绝
         </text>
       </view>
        <uv-textarea v-model="form.refuseReason" placeholder="审核备注，审核拒绝必填"></uv-textarea>
        <view style="display: flex;justify-content: center;margin-top: 10rpx">
          <uv-button :customTextStyle="{color:themConfig.theme.color}" :iconColor="themConfig.theme.color"
                     icon="checkbox-mark" text="提交" @click="submitForm" type="default"></uv-button>
        </view>
      </view>
    </uv-popup>

  </view>
</template>
<script>
import {mixins} from './index.js'

export default {
  mixins: [mixins]
}
</script>

<style scoped lang="scss">
@import './index.scss';
</style>
